<?php

namespace App\Http\Services\FormBuilder\Elements;

class Split extends Input
{
    public $fillable = [
        'id', 'name', 'type', 'placeholder','class'
    ];

    public function placeholder($placeholder)
    {
        $this->setAttribute('placeholder', $placeholder);

        return $this;
    }

    public function defaultValue($value)
    {
        if (!$this->hasValue()) {
            $this->setValue($value);
        }

        return $this;
    }

    protected function hasValue()
    {
        return isset($this->attributes['value']);
    }

    public function editBlock()
    {
        return $this->splitHtml();
    }

    public function detailBlock()
    {
        return $this->splitHtml();
    }

    private function splitHtml()
    {
        $split_html = '';
        $split_html .= '<div class="col-md-12 block-header block-header-default" style="padding:10px;">';
        $split_html .= '<h3 class="block-title">'.$this->attributes['display_name'].'</h3>';
        $split_html .= '</div>';
        return $split_html;
    }

}
